<?php
namespace BP\Sys\FrmUI;
require_once("BP/En/Map.php");
class MapFrameExt extends EntityMyPK {
	public function getUrl () 
	{
		return $this->GetValStrByKey("Tag1");
	}
	public function getFK_MapData () 
	{
		return $this->GetValStrByKey(MapFrameAttr::$FK_MapData);
	}
	public function getName () 
	{
		return $this->GetValStrByKey(MapFrameAttr::$Name);
	}
	public function getHisUAC () 
	{
		$uac = new UAC();
		$uac->IsUpdate =  TRUE ;
		$uac->IsDelete =  TRUE ;
		$uac->IsInsert =  FALSE ;
		return $uac;
	}
	public static function constructor__ () 
	{
		$me = new self();
		return $me;
	}
	public static function constructor__String ($mypk) // [String mypk]
	{
		$me = new self();
		$me->setMyPK($mypk);
		$me->Retrieve();
		return $me;
	}
	public function getEnMap () 
	{
		if (($this->get_enMap() != NULL))
		{
			return $this->get_enMap();
		}
		$map = new Map("Sys_MapFrame", "框架");
		$map->Java_SetDepositaryOfEntity($Depositary->None);
		$map->Java_SetDepositaryOfMap($Depositary->Application);
		$map->Java_SetEnType($EnType->Sys);
		$map->AddMyPK();
		$map->AddTBString(MapFrameAttr::$FK_MapData, NULL, "表单ID",  TRUE ,  TRUE , 0, 100, 20);
		$map->AddTBString(MapFrameAttr::$Name, NULL, "名称",  TRUE ,  FALSE , 0, 200, 20,  TRUE );
		$map->AddDDLSysEnum(MapFrameAttr::$UrlSrcType, 0, "URL来源",  TRUE ,  TRUE , MapFrameAttr::$UrlSrcType, "@0=自定义@1=地图@2=流程轨迹表@3=流程轨迹�?");
		$map->AddTBString(MapFrameAttr::$FrameURL, NULL, "URL",  TRUE ,  FALSE , 0, 3000, 20,  TRUE );
		$map->AddTBString(MapFrameAttr::$URL, NULL, "URL",  FALSE ,  FALSE , 0, 3000, 20,  TRUE );
		$map->AddTBString(FrmEleAttr::$Y, NULL, "Y",  TRUE ,  FALSE , 0, 20, 20);
		$map->AddTBString(FrmEleAttr::$X, NULL, "x",  TRUE ,  FALSE , 0, 20, 20);
		$map->AddTBString(FrmEleAttr::$W, NULL, "宽度",  TRUE ,  FALSE , 0, 20, 20);
		$map->AddTBString(FrmEleAttr::$H, NULL, "高度",  TRUE ,  FALSE , 0, 20, 20);
		$map->AddBoolean(MapFrameAttr::$IsAutoSize,  TRUE , "是否自动设置大小",  FALSE ,  FALSE );
		$map->AddTBString(FrmEleAttr::$EleType, NULL, "类型",  FALSE ,  FALSE , 0, 50, 20,  TRUE );
		$map->AddTBString(FrmEleAttr::$GUID, NULL, "GUID",  FALSE ,  FALSE , 0, 128, 20);
		$map->AddTBInt(MapAttrAttr::$Idx, 0, "顺序�?",  TRUE ,  FALSE );
		$rm = new RefMethod();
		$rm = new RefMethod();
		$rm->Title = "预制";
		$rm->ClassMethodName = ($this . ".DoFrameExt()");
		$rm->refMethodType = $RefMethodType->RightFrameOpen;
		$map->AddRefMethod($rm);
		$this->set_enMap($map);
		return $this->get_enMap();
	}
	public function DoFrameExt () 
	{
		return ("../../Admin/FoolFormDesigner/FrameExt/Default.htm?MyPK=" . $this->getMyPK());
	}
	protected function afterDelete () 
	{
		$gf = GroupField::constructor__();
		$gf->Delete(GroupFieldAttr::$CtrlID, $this->getMyPK());
		CCFormAPI->AfterFrmEditAction($this->getFK_MapData());
		parent->afterDelete();
	}
	protected function beforeUpdateInsertAction () 
	{
		$val = $this->GetValIntByKey(MapFrameAttr::$UrlSrcType, 0);
		if (($val == 1))
		{
			$sql = (("SELECT Url FROM Sys_MapData WHERE No='" . $this->GetValStrByKey(MapFrameAttr::$FrmID)) . "'");
			$url = DBAccess->RunSQLReturnStringIsNull($sql, "");
			$this->SetValByKey(MapFrameAttr::$FrameURL, $url);
			$this->SetValByKey(MapFrameAttr::$URL, $url);
		}
		else
		{
			$this->SetValByKey(MapFrameAttr::$URL, $this->GetValByKey(MapFrameAttr::$FrameURL));
		}
		$gf = GroupField::constructor__();
		$i = $gf->Retrieve(GroupFieldAttr::$FrmID, $this->getFK_MapData(), GroupFieldAttr::$CtrlID, $this->getMyPK());
		if (($i == 1))
		{
			$gf->setLab($this->getName());
			$gf->Update();
		}
		return parent->beforeUpdateInsertAction();
	}
	protected function afterInsertUpdateAction () 
	{
		$mapframe = MapFrame::constructor__();
		$mapframe->setMyPK($this->getMyPK());
		$mapframe->RetrieveFromDBSources();
		$mapframe->Update();
		CCFormAPI->AfterFrmEditAction($this->getFK_MapData());
		parent->afterInsertUpdateAction();
	}
}
?>
